<template>
  <div>
    <!-- <div class="item-container" @click="godetails(item)" v-for="(item,index) in listarr" :key="index">
			<div class="item-box" v-if="item">
				<div class="item_img">
					<img :src="item.cover ? item.cover: item.linkSrc">
				</div>
				<div class="item_title">
					<p v-if="pathname === 'home' || pathname === ''&& item.name">{{item.name}}</p>
					<p v-else>{{item.title}}</p>
				</div>
				<div class="item_ke">
					共计{{item.count}}课节 | {{item.snumber}}人已学
				</div>
				<div class="item_money">
					¥{{item.preferential_money/100}}
					<span>¥{{item.money/100}}</span>
				</div>
			</div>
		</div> -->
    <div class="Rec_box">
      <div
        class="Rec_box_list"
        v-for="(item,index) in listarr"
        :key='index'
        @click="godetails(item)"
      >
        <div
          class="Rec_img"
          :style="'width:'+ w*0.36 +'px;height:'+ w*0.36*0.63 +'px;'"
        >
          <img
            :src="item.cover ? item.cover: item.linkSrc"
            alt=""
          >
        </div>
        <div class="Rec_con">
          <div class="rec_title">{{item.title}}</div>
          <div class="rec_class">{{item.c_title}}</div>
          <section class="teacher-name">{{item.name}}</section>
          <div class="rec_money">
            <!-- <div
              class="obc-tic"
              v-if="item.cur_status"
            >{{item.cur_status == '0' ? '系': '单'}}</div> -->
            {{item.count}}课时 <span><span>¥{{item.money/100}}</span> ¥{{item.preferential_money/100}}</span>
          </div>
        </div>
      </div>
    </div>
  </div>

</template>

<script>
export default {
  data () {
    return {
      listarr: [],
      pathname: '',
      w: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
    }
  },
  created () {
    this.pathname = this.$route.name
    if (this.item instanceof Array) {
      this.listarr = [...this.item]
    } else {
      this.listarr.push(this.item)
    }
  },
  props: ['item', 'status'],
  methods: {
    godetails (item) {
      this.$emit('listcallback', item)
    }
  }
}
</script>

<style lang="less" scoped>
.teacher-name {
  margin-top: 4px;
  font-size: 12px;
  color: #999999;
}
.Recommend_box {
  width: 100%;
}
.Rec_box {
  width: 100%;
}
.Rec_box_list {
  display: flex;
  margin: 15px 0;
}
.Rec_img > img {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  object-fit: cover;
}
.Rec_con {
  flex: 1;
  padding-left:15px;
  position: relative;
}
.rec_title {
  text-align: left;
  font-size: 15px;
  font-weight: bold;
  color: #1a1a1a;
  text-overflow: ellipsis;
  display: -webkit-box;
  /* -webkit-box-orient: vertical; */
  /*! autoprefixer: off */
  -webkit-box-orient: vertical;
  /* autoprefixer: on */
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.rec_class {
  width: 100%;
  font-size: 12px;
  color: #999999;
  position: absolute;
  bottom: 19px;
  left: 15px;
}
.rec_money {
  font-size: 12px;
  width: calc(100% - 20px);
  color: #999999;
  position: absolute;
  bottom: 0;
  left: 15px;
}
.rec_money > span {
  position: absolute;
  right: 0;
  top: 0;
  display: inline-block;
  text-align: right;
  color: #DA4131;
  font-size: 14px;
}
.rec_money > span span {
  position: relative;
  color: #999999;
  font-size: 12px;
}
.rec_money > span span:after {
  position: absolute;
  content: "";
  left: -10%;
  top: 49%;
  width: 120%;
  height: 1px;
  background: #999999;
}
.obc-tic {
  width: 18px;
  height: 18px;
  background-color: #f39800;
  text-align: center;
  line-height: 18px;
  color: #fff;
  position: absolute;
  right: 0;
  bottom: 20px;
}
</style>
